package com.example.verification.demo.controller;

import com.example.verification.demo.common.pojo.res.WebResultBean;
import com.example.verification.demo.common.util.Constants;
import org.apache.tomcat.util.bcel.Const;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * Created by hzy on 2018/12/13.
 */
@RestController
@RequestMapping("/api")
public class TestController {

    @PostMapping("/test/json_body")
    public WebResultBean<String> test(@RequestBody HashMap<String,Object> body){
        WebResultBean<String> webResultBean = new WebResultBean<>();
        webResultBean.setCodeAndMsg(Constants.RespCode.SUCCESS,Constants.RespMsg.SUCCESS);
        webResultBean.data = body.toString();
        return webResultBean;
    }

    @PostMapping("/test/xml_body")
    public WebResultBean<String> test(@RequestBody String xml){
        WebResultBean<String> webResultBean = new WebResultBean<>();
        webResultBean.setCodeAndMsg(Constants.RespCode.SUCCESS,Constants.RespMsg.SUCCESS);
        webResultBean.data = xml;
        return webResultBean;
    }
}
